package com.alex;

import com.alex.pojo.User;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ImportResource;


// @SpringBootApplication 包含以下三个核心注解
//@SpringBootConfiguration
//@EnableAutoConfiguration
//@ComponentScan

// 这是一个 springboot 应用
@SpringBootApplication()
public class MainApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext ctx = SpringApplication.run(MainApplication.class, args);



        System.out.println("========================================================");
        for (String beanDefinitionName : ctx.getBeanDefinitionNames()) {
//            System.out.println(beanDefinitionName);
        }
        System.out.println("========================================================");

        User user01 = ctx.getBean("user01", User.class);
        System.out.println(user01);

        System.out.println(ctx.getBean("user66"));
        System.out.println(ctx.getBean("car"));
        System.out.println(ctx.getBean("person"));

        System.out.println(ctx.containsBean("ababa"));
        System.out.println(ctx.containsBean("acaca"));
    }
}
